package com.zhixi.principle.interfacesegregationprinciple;

import com.zhixi.principle.interfacesegregationprinciple.operation.OperationClassA;
import com.zhixi.principle.interfacesegregationprinciple.operation.OperationClassB;

/**
 * 接口隔离原则
 *
 *  1、一个接口只服务于一个子模块或业务模块
 *  2、接口要高内聚
 *
 * @作者 ShuHaoNan
 * @邮箱 shuhaonan1@gmail.com
 * @时间 2020/11/14 16:42
 */
public class InterfaceSegregationPrinciple {

    /**
     * OperationClassA需要实现 operation1、operation2、operation3方法
     * OperationClassB需要实现 operation1、operation4、operation5方法
     * 需要共同实现operation1，如果只写一个接口都实现同一个接口，则
     * OperationClassA不需要 operation4、operation5 方法
     * OperationClassB不需要 operation2、operation3 方法
     */
    public static void main(String[] args) {
        OperationClassA operationClassA = new OperationClassA();
        OperationClassB operationClassB = new OperationClassB();
        operationClassA.operation1();
        operationClassA.operation2();
        operationClassA.operation3();
        operationClassB.operation1();
        operationClassB.operation4();
        operationClassB.operation5();
    }

}
